<?php
namespace Admin\Controller;
use Think\Controller;
//用户模块
class AdminController extends Controller {
    public function index(){
        //实例化admin表
        $admin = D('admin');
        $list = $admin->admin_sec();
        // dump($list);
        //分配数据
        $this->assign('list',$list['list']);
        //分页
        $this->assign('show',$list['show']);
        //显示管理员模板
        $this->display();
    }
    //显示添加用户模板
    public function add_addmin(){
        $this->display();
    }
    //执行添加用户操作方法
    public function admin_ad(){
        $admin = D('admin');
        $res = $admin->admin_add();
        if($res){
             $this->success('新增成功','',1);
        }else{
            $this->error('添加失败，请确认输入格式是否正确','',1);
        }

    }
    //修改管理员状态
    public function up_admin(){
        $admin = D('admin');
        $res = $admin->admin_up();
        //输出值返回模板
        echo $res;
    }
    //删除管理员
    public function del_admin(){ 
        $admin = D('admin');
        $res = $admin->admin_del(); 
        echo $res;
    }
   
}